/**
 * 初始化创建素材窗口
 * @param mouldId 模块ID
 * @param courseId 课程ID
 */
function initCreateMaterialWind(mouldId,courseId,callback) {
    parent.layer.open({
        type:2,
        area: winArea,
        btn: ['保存', '取消'],
        content: baseloaction + "/admin/course/material/listMaterialType?tag=1&mouldId="+mouldId+"&courseId="+courseId,
        maxmin: true,
        shade: [0.3, '#000'],
        shadeClose: false,
        title: '新建素材',
        type: 2,
        yes: function (index) {
            var frame = parent.layer.getChildFrame('body', index);
            if (frame.find('#materialFrom').length === 0) {
                return false;
            }
            var params = frame.find('#materialFrom').serializeJSON();
            params = JSON.stringify(params);
            saveMaterial(params,index,callback);
        }
    });
    /**
     * 保存素材数据
     * @param params
     * @param index
     * @param callback
     */
    function saveMaterial(params,index,callback) {
        $.ajax({
            url:baseloaction +'/admin/course/material/saveMaterial?status=2',
            type:"post",
            data:params,
            dataType:"json",
            contentType:'application/json;charset=utf-8',
            success:function (result) {
                if(result.success==false){
                    icModale(0, result.message);
                }else{
                    if($.isFunction(callback)){
                        callback(result.entity);
                    }
                    parent.layer.close(index);
                }
            },
            error:function (error) {
                icModale(0, '系统错误，保存素材数据失败');
            }
        });
    }
}